<template>
	<view>
		<view class="container">
			<view class="top-head" :style="'background:' + actcolor">
				<view class="address-icon">
					<image src="../../../static/images/addressicon.png" class="address-img"></image>
				</view>
				<view class="address-text">{{village_name}}#{{address}}</view>
			</view>
			<view class="title">缴费事项</view>
			<input type="text" class="inp-box" v-model="pay_name" value="" placeholder-style="font-size: 28rpx;font-weight: normal;font-stretch: normal;line-height: 60rpx;letter-spacing: 0rpx;color: #c3c3c3;"  placeholder="请填写缴费的事项" />
			<view class="title">缴费金额</view>
			<input type="digit" class="inp-box" v-model="money" value="" placeholder-style="font-size: 28rpx;font-weight: normal;font-stretch: normal;line-height: 60rpx;letter-spacing: 0rpx;color: #c3c3c3;" placeholder="请输入缴纳的费用（元）" />
			<view class="btn">
				<button type="primary" :style="btn_style" class="btn-pry" @tap="uPublishTap">去缴费</button>
			</view>
		</view>	
	</view>
</template>

<script>
	var common = require('../../../utils/common.js');
	var app = getApp();
	var _this;
	const getpayMentlist = () => {
		var money = Number(_this.money)
		common.post('HouseApi&a=custom_pay', {
			village_id: _this.village_id,
			pigcms_id: _this.pigcms_id,
			pay_type: "custom",
			pay_name: _this.pay_name,
			money: money,
		}, data => {
			console.log('+++++++++++++', data)
			common.parseUrl(data.order_url)
		});
	};

	export default {
		data() {
			return {
				village_id: 0,
				pigcms_id: 0,
				village_name: '',
				money: '',
				pay_name:'',
				url: '',
				actcolor:'',
				btn_style:'',
				address:'',
			}
		},
		onShow() {
			// #ifdef H5
			common.hideWxShare()
			// #endif
		},
		onLoad(options) {
			_this = this;
			// #ifdef H5
			console.log('准备跳小程序页', _this);
			common.webToMiniapp(_this.route, options, 'redirect')
			// #endif
			_this.address = uni.getStorageSync('address_key');
			common.setMainColor(_this, function(config) {
				_this.actcolor = config.config.mobile_head_color
				_this.btn_style = 'background-color: ' + _this.actcolor + ';box-shadow:0px 30rpx 30rpx -30rpx ' + _this.actcolor + ';';
				const res = uni.getStorageSync('village_key');
				if (res) {
					_this.village_id = res.village_id;
					_this.pigcms_id = res.pigcms_id;
					_this.village_name = res.village_name;
				};
			});
		
		},
		methods: {
			uPublishTap(){	
				getpayMentlist()
			}
		},
		components: {
			
		},
	}
</script>

<style>
	page {
		background: rgb(245, 245, 245);
	}

	.container {
		margin: 0;
		padding: 0;
	}
	.top-head {
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
	}
	.address-icon {
		width: 20rpx;
		height: 30rpx;
		margin-right: 15rpx;
	}
	.address-img {
		display: block;
		width: 100%;
		height: 100%;
	}
	.address-text {
		font-size: 28rpx;
		font-weight: normal;
		font-stretch: normal;
		line-height: 100rpx;
		letter-spacing: 0rpx;
		color: #ffffff;
	}
	.title {
		margin-left: 30rpx;
		font-size: 26rpx;
		font-weight: normal;
		font-stretch: normal;
		line-height: 50px;
		letter-spacing: 0rpx;
		color: #333333;
	}
	.inp-box {
		background: #FFFFFF;
		margin: 0rpx 30rpx;
		padding: 30rpx;
		border-radius: 10rpx;
	}
	.btn {
		margin: 74rpx 0rpx;
		height: 100%;
		width: 100%;
	}
	.btn-pry {
		width: 550rpx;
		height:98rpx;
		background: #2681f3;
		border-radius:49rpx;
		line-height: 98rpx;
		margin-top: 220rpx;
	}
</style>
